package cn.iocoder.yudao.module.nmkj.dal.mysql.introduction;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.nmkj.dal.dataobject.introduction.IntroductionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.nmkj.controller.admin.introduction.vo.*;

/**
 * 商品介绍 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IntroductionMapper extends BaseMapperX<IntroductionDO> {

    default PageResult<IntroductionDO> selectPage(IntroductionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IntroductionDO>()
                .eqIfPresent(IntroductionDO::getSwitchTab, reqVO.getSwitchTab())
                .eqIfPresent(IntroductionDO::getImg, reqVO.getImg())
                .eqIfPresent(IntroductionDO::getDescribes, reqVO.getDescribes())
                .eqIfPresent(IntroductionDO::getTitle, reqVO.getTitle())
                .eqIfPresent(IntroductionDO::getContent, reqVO.getContent())
                .eqIfPresent(IntroductionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IntroductionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IntroductionDO::getStatus)
                .orderByDesc(IntroductionDO::getSort));
    }

    default List<IntroductionDO> selectList(IntroductionPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IntroductionDO>()
                .eqIfPresent(IntroductionDO::getSwitchTab, reqVO.getSwitchTab())
                .eqIfPresent(IntroductionDO::getImg, reqVO.getImg())
                .eqIfPresent(IntroductionDO::getDescribes, reqVO.getDescribes())
                .eqIfPresent(IntroductionDO::getTitle, reqVO.getTitle())
                .eqIfPresent(IntroductionDO::getContent, reqVO.getContent())
                .eqIfPresent(IntroductionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IntroductionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IntroductionDO::getStatus)
                .orderByDesc(IntroductionDO::getSort));
    }

}